package javaframework;

import java.awt.Graphics2D;
import java.awt.image.BufferedImage;

import framework.GraphicsWrapper;
import framework.ImageWrapper;

public class JavaImage implements ImageWrapper {
	private final BufferedImage my_image;
	public JavaImage(final int the_width,
			final int the_height) {
		
		my_image = new BufferedImage(the_width, the_height, BufferedImage.TYPE_INT_ARGB);
	}
	public JavaImage(final BufferedImage the_image) {
		my_image = the_image;
	}

	@Override
	public int getWidth() {
		return my_image.getWidth();
	}

	@Override
	public int getHeight() {
		return my_image.getHeight();
	}
	
	public BufferedImage getBufferedImage() {
		return my_image;
	}
	
	@Override
	public GraphicsWrapper getGraphics() {
		final JavaGraphics g = new JavaGraphics(my_image.getWidth(), my_image.getHeight());
		g.setGraphics((Graphics2D) my_image.getGraphics());
		return g;
	}


	@Override
	public void dispose() {
		
	}

}
